<?php
/**
 * Created by PhpStorm.
 * User: W
 * Date: 2019/1/4
 * Time: 15:15
 */

namespace app\sports_admin\model;

use think\Request;
use think\Model;

class ChildrenWeight extends Model
{
    protected $table = "children_weight";
    protected $pk    = "id";
    protected $autoWriteTimestamp = true;
    public static function weightList($page,$rows,$sort,$sortOrder)
    {
        $adminList = self::
        page($page)
            ->limit($rows)
            ->order("{$sort}","{$sortOrder}")->select();

        $adminCount = self::count();
        return ['rows'=>$adminList,'total'=>$adminCount];
    }
    //体重
    public static function thisWeight($weight)
    {
        return self::where('weight',$weight)->find();
    }
    //添加体重
    public static function weightAdd($weight)
    {
        return self::create(['weight'=>$weight]);
    }
    //删除体重
    public static  function weightDel()
    {
        $data = Request::instance()->only("id");
        return self::where('id',$data['id'])->delete();
    }

}